{% extends 'base.html' %}
{% block title %}
报告
{% endblock %}
{% block content %}
<div class="btn-group">
    <button type="button" class="btn btn-info">{{ product.name }}</button>
    <button type="button" class="btn btn-primary dropdown-toggle btn-sm" data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">切换下拉菜单</span>
    </button>
    <ul class="dropdown-menu" role="menu">
        {% for pd in products %}
        <li><a href="{{ url_for('wx.bp_report.report',pk=pd.id) }}">{{ pd.name }}</a></li>
        {% endfor %}
    </ul>
</div>
<br>
<br>
<h5>报告列表</h5>
<br>
<div class="row">
    <div class="col-sm-12">
        <div class="table-responsive">
            <table class="table table-bordered table-striped table-sm">
                <thead>
                    <tr>
                        <!-- <th>报告ID</th> -->
                        <th>用例名称</th>
                        <th class="text-success">通过数</th>
                        <th class="text-danger">失败数</th>
                        <th>任务类型</th>
                        <th>查看BUG</th>
                        <th>执行时间</th>
                    </tr>
                </thead>
                <tbody>
                    {% if results %}
                    {% for report in results %}
                    <tr>
                        <!-- <td><strong class="text-info">{{ report.pk }}</strong></td> -->
                        {% if report.name %}
                        <td><strong>{{ report.name }}</strong></td>
                        {% else %}
                        <td class="text-muted">未获取到名称</td>
                        {% endif %}
                        <td><span {% if report.success %} class="badge badge-success" {% endif %}>{{ report.success
                                }}</span></td>
                        <td><span {% if report.failure %} class="badge badge-danger" {% endif %}>{{ report.failure
                                }}</span></td>
                        <td>{% if report.types == 1 %} 异步任务{% else %}定时任务{% endif %}</td>
                        {% if report.failure %}
                        <td>
                            <button type="button" class="btn btn-outline-info btn-sm">
                                <a href="{{ url_for('wx.bp_report.bug') }}?task_id={{ report.task_id }}">点击查看问题</a>
                            </button>
                        </td>
                        {% else %}
                        <td><strong class="text-info">暂无BUG</strong></td>
                        {% endif %}
                        <td>{{ moment(report.updated).format('lll') }}</td>
                    </tr>
                    {% endfor %}
                    {% else %}
                    <p style="color: red">暂无数据</p>
                    {% endif %}
                </tbody>
            </table>
        </div>
    </div>
</div>

{% endblock %}